package algotithms.easy;

/*
 * leetcode 算法 461题
 * 统计 x，y两数二进制数不同的位数
 */
public class HammingDistance {

	public static int hammingDistance(int x, int y){
		
		int z = x^y;
		int count = 0;
		do{
			if(z % 2 == 1){
				count ++;
			}
			z = z / 2;
		}while(z >= 1);
		return count;
	}
	
	public static void main(String[] args){
	
		int result = hammingDistance(4, 1);
		System.out.println(result);
		
	}
	
}
